package com.ehi.alliance.dao;

import com.ctrip.framework.apollo.ConfigService;
import com.ehi.common.domain.alliance.AllianceInfo;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;

import static org.assertj.core.api.Assertions.assertThat;

/**
 * Created by portz on 6/13/2017.
 */
@RunWith(SpringRunner.class)
@SpringBootTest
@ActiveProfiles(value = "dev")
public class AllianceDaoIT {

    //@Value("${alliance.port}")
    private String value;
    @Autowired
    private AllianceDao dao;

    @Before
    public void setUp() throws Exception {

    }

    @Test
    public void getByAllianceId() throws Exception {
        String value2 = ConfigService.getAppConfig().getProperty("timeout","0");
        AllianceInfo info = dao.getByAllianceId("5");
        assertThat(info).isNotNull();
        assertThat(info.getName()).isEqualTo("Amsterdam");
        assertThat(value2).isEqualTo("100");
    }

    @Test
    public void getAllianceProductLines() throws Exception {
        String info = dao.getAllianceProductLines("5");
        assertThat(info).isNotNull();
        assertThat(info).isEqualTo("Amsterdam");
        //assertThat(this.value).isEqualTo("port");
    }

}
